<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">
<f:view locale="#{salaoMB.internacionalizacao.currentLocale}">
<h:head>

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />

<title>Servicos cadastrados</title>
<link rel="stylesheet" href="../css/salao.css" type="text/css"	media="screen" />  

</h:head>
<h:body styleClass="bg-content">

	<table width="100%">
		<tr>
			<td><ui:include src="/index.xhtml" /></td>
		</tr>
	</table>
	
		<h:form prependId="false">  
		
		<p:contextMenu> 
	 		<p:menuitem value="Menu Principal" url="/pages/main.faces" icon="ui-icon-extlink"/>
		</p:contextMenu>
		
<table width="50%" align="center">
	<tr>
		<td>
		<p:panel header="Buscar serviços por Estabelecimento: ">

			<h:panelGrid id="datasEstabelecimentoSemExpediente" columns="3" cellpadding="5">
			
				<h:outputText id="textEstabelecimento" value="Estabelecimento: " />
						
				<h:selectOneMenu value="#{servicosMB.idSelectedEstabelecimento}" rendered="true" id="estabelecimento" immediate="true" >			
					<f:selectItem itemLabel="Selecione..." itemValue="0" noSelectionOption="true"/>
					<f:selectItems value="#{servicosMB.mapEstabelecimento}" var="estabelecimento" itemLabel="#{estabelecimento.nomeFantasia}" itemValue="{estabelecimento.id}" />							   		
				</h:selectOneMenu> 
					
				<p:commandLink id="btnFind" update="dataTable" action="#{servicosMB.buscarServicosPorIdEstabelecimento}">
                    	<p:graphicImage value="/img/find.gif" width="20" height="20"/>
              	</p:commandLink>	
              	 
			</h:panelGrid>			
		</p:panel>		
		</td>
	</tr>
</table>   
<br />	
<table width="100%" align="center">
	<tr>
		<td align="center">	
    	<p:dataTable id="dataTable" var="servico" value="#{servicosMB.listServicos}"  style="width:50%"
                 paginator="true" rows="10"  
                 paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
                 rowsPerPageTemplate="5,10,15" emptyMessage="N&atilde;o há dados registrados para o estabelecimento selecionado" >  
        <f:facet name="header">  
            Serviços  
        </f:facet>  
  
        <p:column sortBy="#{servico.descricao}">  
            <f:facet name="header">  
                <h:outputText value="Descrição" />  
            </f:facet>  
            <h:outputText value="#{servico.descricao}" />  
        </p:column>   
        <p:column>  
            <f:facet name="header">  
                <h:outputText value="Preço" />  
            </f:facet>  
            <h:outputText value="#{servico.preco}" >  
            	<f:convertNumber pattern="#,##0.00"/>
            </h:outputText>
        </p:column> 
        <p:column> 
            <f:facet name="header">  
                <h:outputText value="Duração do Serviço" />  
            </f:facet>  
            <h:outputText value="#{servico.duracaoServico}" >    
            	<f:convertDateTime pattern="HH:mm" timeZone="GMT-03:00" /> 
            </h:outputText>     
        </p:column> 
    	</p:dataTable>    
 </td>
	</tr>
</table>    

</h:form>  
</h:body>
</f:view>
</html>